package org.cfx.gift.exception;

import org.cfx.gift.exception.code.ResponseCode;

/**
 * 自定义的业务类异常,如果要将业务相关的异常信息返回给前端,就通过该类去返回
 */
public class BusinessException extends RuntimeException{

    // 错误码
    private Integer code;

    private ResponseCode responseCode;

    public BusinessException() {
        super();
    }

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public BusinessException(ResponseCode code) {
        super(code.getMessage());
        this.code = code.getCode();
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }


}
